package com.luchao.back.service.impl;

import com.luchao.back.mapper.ColorMapper;
import com.luchao.back.pojo.Color;
import com.luchao.back.service.ColorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ColorServiceImpl implements ColorService {

    @Autowired
    private ColorMapper colorMapper;

    @Override
    public List<Color> getColorByPage(int pageNum, int pageSize) {
        return colorMapper.getColorByPage((pageNum - 1) * pageSize, pageSize);
    }

    @Override
    public int addColor(Color color) {
        return colorMapper.addColor(color);
    }

    @Override
    public int editColor(Color color) {
        return colorMapper.editColor(color);
    }

    @Override
    public long getColorCount() {
        return colorMapper.getColorCount();
    }

    @Override
    public boolean batchChangeState(List<Color> list) {
        return colorMapper.batchChangeState(list) > 0 ? true : false;
    }

    @Override
    public int checkColor(String cname) {
        return colorMapper.checkColor(cname);
    }

    @Override
    public List<Color> getAllColor() {
        return colorMapper.getAllColor();
    }

    @Override
    public List<Color> getAllColorForView() {
        return colorMapper.getAllColorForView();
    }
}
